/**
 * 
 */
package br.com.ufrn.aipetro.ga.domain.entity.device.sensor;

import java.util.Date;


import br.com.ufrn.aipetro.ga.domain.entity.device.Critical;
import br.com.ufrn.aipetro.ga.domain.entity.device.Device;
import br.com.ufrn.aipetro.ga.domain.entity.device.OperationStatus;
import br.com.ufrn.aipetro.ga.domain.entity.device.Protocol;
import br.com.ufrn.aipetro.ga.domain.entity.mesh.Mesh;

/**
 * <p>
 * Sensor.
 * </p>
 * 
 * <p>
 * <b>Atributos</b>: <br>
 * <b>name</b> - Nome do sensor <br>
 * </p>
 * 
 * @author Lucas
 * @author Andre
 * 
 */
public class Sensor extends Device {

	public static final String NAME_PROPERTY = "name";
	public static final String OPERATION_TEMPERATURE_PROPERTY = "operationTemperature";
	public static final String RANGED_PROPERTY = "ranged";
	public static final String SAMPLE_RATE_PROPERTY = "sampleRate";
	
	private String name;
	private float operationTemperature;
	private float ranged;
	private float sampleRate;
	
	/**
	 * 
	 */
	public Sensor() {
		
	}

	/**
	 * @param deviceId
	 * @param serialNumber
	 * @param model
	 * @param manufacturer
	 * @param mesh
	 * @param tag
	 * @param operationStatus
	 * @param protocol
	 * @param critical
	 * @param dateOperationStart
	 * @param dateOperationFinish
	 */
	public Sensor(String name, float operationTemperature,
			float ranged, float sampleRate, String deviceId, String serialNumber, String model,
			String manufacturer, Mesh mesh, String tag,
			OperationStatus operationStatus, Protocol protocol,
			Critical critical, Date dateOperationStart, Date dateOperationFinish) {
		
		
		super(deviceId, serialNumber, model, manufacturer, mesh, tag, operationStatus,
				protocol, critical, dateOperationStart, dateOperationFinish);
		
		this.name = name;
		this.operationTemperature = operationTemperature;
		this.ranged = ranged;
		this.sampleRate = sampleRate;
	
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @return the operationtemperature
	 */
	public float getOperationTemperature() {
		return operationTemperature;
	}
	
	/**
	 * @return the range
	 */
	public float getRanged() {
		return ranged;
	}
	/**
	 * @return the samplerate
	 */
	public float getSampleRate() {
		return sampleRate;
	}
	
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		String oldName = this.name;
		this.name = name;
		
		firePropertyChange(NAME_PROPERTY, oldName, name);
	}

	/**
	 * @param operationtemperature the operationtemperature to set
	 */
	public void setOperationTemperature(float operationTemperature) {
		float oldOperationTemperature = this.operationTemperature;
		this.operationTemperature = operationTemperature;
		
		firePropertyChange(OPERATION_TEMPERATURE_PROPERTY, oldOperationTemperature, operationTemperature);
	}
	
	/**
	 * @param range the range to set
	 */
	public void setRanged(float ranged) {
		float oldRanged = this.ranged;
		this.ranged = ranged;
		
		firePropertyChange(RANGED_PROPERTY, oldRanged, ranged);
	}

	/**
	 * @param samplerate the samplerate to set
	 */
	public void setSampleRate(float sampleRate) {
		float oldSampleRate = this.sampleRate;
		this.sampleRate = sampleRate;
		
		firePropertyChange(SAMPLE_RATE_PROPERTY, oldSampleRate, sampleRate);
	}

}
